﻿#ifndef SENSERCLIENT_H
#define SENSERCLIENT_H

#include "smart_senser_slice_header.h"
#include "smart_senser_slice_api.h"
#include <string>
#include <Ice/Ice.h>

using namespace std;
using namespace desig;

class SenserClient : public desig::slice_api::Client
{
public:
    explicit SenserClient();
    ~SenserClient();
    //全局接口
    virtual void OnConnect(const::Ice::Current& current) override;
    virtual void OnTaskIdChanged(int wb_id, long long task_id, const::Ice::Current& current) override;
    virtual void OnSystemWorkModes(desig::slice_api::SystemWorkModeArray modes, const::Ice::Current& current) override;
    virtual void OnControlModeChanged(desig::slice_api::ControlMode mode, const::Ice::Current& current) override;
    virtual void OnDetectLibrariesInfos(desig::slice_api::DetectAlgLibraryInfoArray libraries, const::Ice::Current& current) override;
    virtual void OnRecogLibrariesInfos(desig::slice_api::RecogAlgLibraryInfoArray libraries, const::Ice::Current& current) override;
    virtual void OnDemodLibrariesInfos(desig::slice_api::DemodAlgLibraryInfoArray libraries, const::Ice::Current& current) override;
    virtual void OnMessage(desig::slice_api::MessageInfoArray infos, const::Ice::Current& current) override;
    virtual void OnStates(::std::string key, ::std::string value, const::Ice::Current& current) override;
    virtual void OnUpdateSettingInfos(desig::slice_api::SettingInfoArray infos, const::Ice::Current& current) override;
    virtual void OnComponentInfo(desig::slice_api::ComponentInfoArray infos, const::Ice::Current& current) override;
    virtual void OnDeleteListGroupInfo(desig::slice_api::ListType type, desig::slice_api::StringArray guids, const::Ice::Current& current) override;
    virtual void OnCreateListGroupInfo(desig::slice_api::ListType type, desig::slice_api::ListGroupInfoArray group_infos, const::Ice::Current& current) override;
    virtual void OnUpdateListGroupInfo(desig::slice_api::ListType type, desig::slice_api::ListGroupInfoArray group_infos, const::Ice::Current& current) override;
    virtual void OnDeleteListSignalInfo(desig::slice_api::ListType type, desig::slice_api::ListGroupArray groups, const::Ice::Current& current) override;
    virtual void OnCreateListSignalInfo(desig::slice_api::ListType type, desig::slice_api::ListGroupArray groups, const::Ice::Current& current) override;
    virtual void OnUpdateListSignalInfo(desig::slice_api::ListType type, desig::slice_api::ListGroupArray groups, const::Ice::Current& current) override;
    virtual void OnCreatedWaveforms(desig::slice_api::WaveformInfoArray waveforms, const::Ice::Current& current) override;
    virtual void OnDeletedWaveforms(desig::slice_api::StringArray ids, const::Ice::Current& current) override;
    virtual void OnUpdatedWaveforms(desig::slice_api::WaveformInfoArray waveforms, const::Ice::Current& current) override;

    //采集设备接口
    virtual void OnSelectDevice(desig::slice_api::DeviceInfo info, const::Ice::Current& current) override;
    virtual void OnDeviceInfos(desig::slice_api::DeviceInfoArray info, const::Ice::Current& current) override;
    virtual void OnDeviceSettingsChanged(desig::slice_api::DeviceSettings setting, const::Ice::Current& current) override;
    virtual void OnDeviceNarrowbandSettingsChanged(desig::slice_api::DeviceNarrowbandSettings setting, const::Ice::Current& current) override;
    virtual void OnDeviceRunningStatus(bool status, const::Ice::Current& current) override;
    virtual void OnDeviceConnectStatus(bool status, const::Ice::Current& current) override;
    virtual void OnFPGALoadStart(std::string guid, const::Ice::Current& current) override;
    virtual void OnFPGALoadProgress(int progress, const::Ice::Current& current) override;
    virtual void OnFPGALoadComplete(std::string guid, bool success, const::Ice::Current& current) override;
    virtual void OnFrequnecyConverterChanged(int wb_id, desig::slice_api::FreqConverterInfo converter, const::Ice::Current& current) override;
    virtual void OnSatelliteInfoChanged(int wb_id, desig::slice_api::SatelliteInfo info, const::Ice::Current& current) override;
    virtual void OnInvertSpectrumChanged(int wb_id, bool invert_spectrum, const::Ice::Current& current) override;
    virtual void OnRadioInputChannelChanged(int channel, const::Ice::Current& current) override;
    virtual void OnDeviceChannelEnablementStatus(int wb_id, bool status, const::Ice::Current& current) override;
    virtual void OnDeviceWorkModeChanged(int wb_id, desig::slice_api::DeviceWorkMode mode, const::Ice::Current& current) override;
    virtual void OnDeviceParamsChanged(int wb_id, desig::slice_api::FrequnecyInfo info, const::Ice::Current& current) override;
    virtual void OnLevelChanged(int wb_id, float level, const::Ice::Current& current) override;
    virtual void OnGainChanged(int wb_id, desig::slice_api::GainControlType type, desig::slice_api::GainMode mode, float gain, const::Ice::Current& current) override;
    virtual void OnTransmissionGainChanged(int wb_id, float gain, const::Ice::Current& current) override;
    virtual void OnDigitalGainChanged(int wb_id, float gain, const::Ice::Current& current) override;
    virtual void OnDevicePlaybackStateChanged(int wb_id, desig::slice_api::PlaybackStatus status, const::Ice::Current& current) override;
    virtual void OnDevicePlaybackLoopStateChanged(int wb_id, bool loop, const::Ice::Current& current) override;
    virtual void OnDevicePlaybackParamsChanged(int wb_id, desig::slice_api::PlaybackInfo info, const::Ice::Current& current) override;
    virtual void OnDevicePlaybackProgress(int wb_id, desig::slice_api::PlaybackProgress progress, const::Ice::Current& current) override;
    virtual void OnStartDeviceBroadbandStorage(int wb_id, desig::slice_api::DataFormat format, desig::slice_api::DataStorageInfo info, const::Ice::Current& current) override;
    virtual void OnStopDeviceBroadbandStorage(int wb_id, const::Ice::Current& current) override;
    virtual void OnDeviceBroadbandStorageProgress(int wb_id, desig::slice_api::DataStoreProgress progress, const::Ice::Current& current) override;
    virtual void OnDeviceBroadbandStorageFile(int wb_id, ::std::string file, const::Ice::Current& current) override;
    virtual void OnDeviceSpectrumOutputChanged(int wb_id, bool enabled, const::Ice::Current& current) override;
    virtual void OnDeviceSpectrumParamsChanged(int wb_id, desig::slice_api::SpectrumInfo info, const::Ice::Current& current) override;
    virtual void OnStartDeviceSpectrumStorage(int wb_id, desig::slice_api::SpectrumStorageInfo info, const::Ice::Current& current) override;
    virtual void OnStopDeviceSpectrumStorage(int wb_id, const::Ice::Current& current) override;
    virtual void OnDeviceSpectrumStorageProgress(int wb_id, desig::slice_api::DataStoreProgress progress, const::Ice::Current& current) override;
    virtual void OnDeviceSpectrumStorageFile(int wb_id, ::std::string file, const::Ice::Current& current) override;
    virtual void OnDeviceSpectrumOutput(int wb_id, desig::slice_api::SpectrumPacket packet, const::Ice::Current& current) override;
    virtual void OnSpectrumDetectorSignal(int wb_id, desig::slice_api::SpectrumSignalInfoArray infos, const::Ice::Current& current) override;
    virtual void OnStartDeviceSpectrumAnalyzer(int wb_id, const::Ice::Current& current);
    virtual void OnStopDeviceSpectrumAnalyzer(int wb_id, bool storage_data, const::Ice::Current& current);
    virtual void OnDeviceSpectrumAnalyzerCacheDuration(int wb_id, int duration, const::Ice::Current& current);
    virtual void OnDeviceSpectrumAnalyzeStoreFiles(int wb_id, desig::slice_api::BroadbandFileInfoArray files, const::Ice::Current& current);

    //检测识别接口
    virtual void OnStartDetectRecog(int wb_id, desig::slice_api::DetectRecogInfo info, const::Ice::Current& current) override;
    virtual void OnStopDetectRecog(int wb_id, const::Ice::Current& current) override;
    virtual void OnDetectRecogProgress(int batch, int signal_index, ::std::string guid, const::Ice::Current& current) override;
    virtual void OnDetectRecogSignals(int wb_id, desig::slice_api::DetectRecogSignalArray signals_, const::Ice::Current& current) override;
    virtual void OnDetectRecogSignalStates(int wb_id, desig::slice_api::DetectRecogSignalStateArray states, const::Ice::Current& current) override;
    virtual void OnDetectRecogSignalSampleFile(int wb_id, ::std::string signal_id, ::std::string ddc_file, ::std::string demod_file, ::std::string decode_file, const::Ice::Current& current) override;
    virtual void OnCrateDetectRecogSignal(int wb_id, desig::slice_api::DetectRecogSignalArray signals_, const::Ice::Current& current) override;
    virtual void OnDeleteDetectRecogSignal(int wb_id, desig::slice_api::StringArray ids, const::Ice::Current& current) override;
    virtual void OnDetectRecogSampleStoreStatus(int wb_id, bool enabled, const::Ice::Current& current) override;
    virtual void OnDetectRecogAutoCollectStatus(int wb_id, bool collect_known_signal, bool collect_unknown_signal, const::Ice::Current& current) override;

    //信道采集接口
    virtual void OnCreateCollectSignals(int wb_id, desig::slice_api::CollectSignalArray signals_, const::Ice::Current& current) override;
    virtual void OnDeleteCollectSignals(int wb_id, desig::slice_api::StringArray signals_, const::Ice::Current& current) override;
    virtual void OnUpdateCollectSignals(int wb_id, desig::slice_api::CollectSignalArray signals_, const::Ice::Current& current) override;
    virtual void OnCollectSignalWorkStatus(int wb_id, desig::slice_api::StringArray ids, bool status, const::Ice::Current& current) override;
    virtual void OnCollectSignalStoreStatus(int wb_id, desig::slice_api::StringArray ids, bool status, const::Ice::Current& current) override;
    virtual void OnCollectSignalAnalysisStatus(int wb_id, desig::slice_api::StringArray ids, bool status, const::Ice::Current& current) override;
    virtual void OnCollectSignalCarrierNoiseRate(int wb_id, string signal_id, float carrier_noise_rate, const::Ice::Current& current) override;
    virtual void OnCollectSignalStoreProgress(int wb_id, ::std::string signal_id, desig::slice_api::DataStoreProgress progress, const::Ice::Current& current) override;
    virtual void OnCollectSignalStoreFile(int wb_id, ::std::string signal_id, ::std::string file, const::Ice::Current& current) override;

    //载波分析接口
    virtual void OnAnalysisParamsChanged(desig::slice_api::AnalysisInfo info, const::Ice::Current& current) override;
    virtual void OnStartAnalysis(const::Ice::Current& current) override;
    virtual void OnStopAnalysis(const::Ice::Current& current) override;
    virtual void OnAnalysisSpectrumParamsChanged(desig::slice_api::SpectrumInfo info, const::Ice::Current& current) override;
    virtual void OnStartAnalysisDataStorage(desig::slice_api::DataStorageInfo info, const::Ice::Current& current) override;
    virtual void OnStopAnalysisDataStorage(const::Ice::Current& current) override;
    virtual void OnAnalysisMeasure(bool state, desig::slice_api::AnalysisMeasureResult packet, const::Ice::Current& current) override;
    virtual void OnAnalysisRecog(bool state, desig::slice_api::AnalysisRecogResult packet, const::Ice::Current& current) override;
    virtual void OnAnalysisSpectrumOutput(desig::slice_api::AnalysisSpectrumPackets packet, const::Ice::Current& current) override;
    virtual void OnAnalysisDataStorageProgress(desig::slice_api::DataStoreProgress progress, const::Ice::Current& current) override;
    virtual void OnAnalysisDataStorageFile(::std::string file, const::Ice::Current& current) override;

    //信号解调接口
    virtual void OnStartDemod(desig::slice_api::DemodInfo info, const::Ice::Current& current) override;
    virtual void OnStopDemod(const::Ice::Current& current) override;
    virtual void OnDemodConstelOutput(desig::slice_api::ConstelPacket packet, const::Ice::Current& current) override;
    virtual void OnDemodSymbolOutput(desig::slice_api::SymbolPacket packet, const::Ice::Current& current) override;
    virtual void OnDemodEyeOutput(desig::slice_api::EyePacket packet, const::Ice::Current& current) override;
    virtual void OnDemodAnalogOutput(desig::slice_api::AnalogPacket packet, const::Ice::Current& current) override;
    virtual void OnPhaseInfo(desig::slice_api::PhaseInfo info, const::Ice::Current& current) override;
    virtual void OnSignalQualityInfo(desig::slice_api::SignalQualityInfo info, const::Ice::Current& current) override;
    virtual void OnStartDemodResultStorage(const::Ice::Current& current) override;
    virtual void OnStopDemodResultStorage(const::Ice::Current& current) override;
    virtual void OnDemodResultStorageProgress(desig::slice_api::DataStoreProgress progress, const::Ice::Current& current) override;
    virtual void OnDemodResultStorageFile(::std::string file, const::Ice::Current& current) override;

    //高速解调
    void OnHighSpeedDemodParamsChange(int channel_id, slice_api::HighSpeedDemodInfo info,
                                      const Ice::Current &current) override;
    void OnStartHighSpeedDemod(int channel_id, const Ice::Current &current) override;
    void OnStopHighSpeedDemod(int channel_id, const Ice::Current &current) override;
    void OnHighSpeedDemodBitstreamInfo(int channel_id, slice_api::BitstreamInfo info,
                                       const Ice::Current &current) override;
    void OnHighSpeedDemodConstellationDiagramInfo(int channel_id, slice_api::ConstellationDiagramInfo info,
                                                  const Ice::Current &current) override;
    void OnStartHighSpeedDemodRawDataStorage(int channel_id, slice_api::DataStorageInfo params,
                                             const Ice::Current &current) override;
    void OnStopHighSpeedDemodRawDataStorage(int channel_id, const Ice::Current &current) override;
    void OnHighSpeedDemodRawDataStorageFile(int channel_id, ::std::string filename,
                                            const Ice::Current &current) override;
    void OnHighSpeedDemodRawDataStorageProgress(int channel_id, slice_api::DataStoreProgress progress,
                                                const Ice::Current &current) override;
    void OnStartHighSpeedDemodResultsStorage(int channel_id, const Ice::Current &current) override;
    void OnStopHighSpeedDemodResultsStorage(int channel_id, const Ice::Current &current) override;
    void OnHighSpeedDemodResultsStorageFile(int channel_id, ::std::string filename,
                                            const Ice::Current &current) override;
    void OnHighSpeedDemodResultsStorageProgress(int channel_id, slice_api::DataStoreProgress progress,
                                                const Ice::Current &current) override;

    // 通过 Client 继承
    virtual void OnCreateTaskInfo(desig::slice_api::TaskInfoArray infos, const::Ice::Current& current) override;
    virtual void OnUpdateTaskInfo(desig::slice_api::TaskInfoArray infos, const::Ice::Current& current) override;
    virtual void OnDeleteTaskInfo(desig::slice_api::StringArray guids, const::Ice::Current& current) override;
    virtual void OnTaskExecuteStatus(desig::slice_api::StringArray guids, bool state, const::Ice::Current& current) override;
    virtual void OnTaskRunningStatus(::std::string guid, desig::slice_api::TaskStatus state, const::Ice::Current& current) override;

    uint64_t getDeviceId() const;
    void setDeviceId(const uint64_t &value);

private:
    uint64_t deviceId;
};

#endif // SENSERCLIENT_H
